package com.daoserver.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.daoserver.mq.RabbitSender;

@RefreshScope
@RestController
public class MqController {

	private final Logger logger = Logger.getLogger(getClass());

	private static int a = 0;

	@Autowired
	RabbitSender rabbitSender;

	@RequestMapping(value = "/mq/test", method = RequestMethod.GET)
	public String test() {
		String msg = a + "";
		rabbitSender.sendMessage(msg);
		a++;
		return msg;
	}

}